﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teriri.File.UniversalLib.Model;
using TouchSocket.Dmtp.Rpc;
using TouchSocket.Rpc;

namespace Teriri.File.Client
{
    public static class TeririRpcActorExtension
    {
        public static RpcResultModel<T> InvokeResult<T>(this IRpcClient client, string invokeKey, params object[] parameters)
        {
            var option = new DmtpInvokeOption()
            {
                Timeout = 10 * 1000,
                FeedbackType = FeedbackType.WaitInvoke,
                SerializationType = TouchSocket.Core.SerializationType.Json,
            };

            var res = client.Invoke(typeof(RpcResultModel<T>), invokeKey, option, parameters);
            return res as RpcResultModel<T>;
        }
    }
}
